pp108 : notify() Method

notify() Method


This method displays notifications such as validation messages and process completion indicators.

Syntax

application.notify(sMessage,[sTitle],[oControl],[oFeedbackObject]);

Parameters

Parameter

Description

sMessage

Required. String that denotes the notification message to be displayed.

sTitle

Optional. String that denotes the title of the notification message.

oControl

Optional. An HTML object that refers to the control for which the notification is issued. When specified for a control, the notification message is positioned near the control, instead of being stacked with other notification messages.

oFeedbackObject

Optional. A JavaScript object that helps convert the notification description into a hyperlink. Clicking the description opens the detailed message in a separate window. This object comprises the following properties:

  • applicationDefinition : If specified,application.select()is executed with the application definition when you click the notification message.
  • callbackFunction : Denotes a function pointer. When specified, it executed when you click the notification message.
  • relatedHTMLelement : Denotes an HTML object. When specified, it sets the focus to the HTML object when you click the notification message.
  • detail : Refers to an XML or non-XML element node. When specified, it displays the details of the notification message in a separate window. For an XML node, the window can be expanded or collapsed using the More or Less option.

Return Value

It does not return a value.

Remarks

You must provide the textual content to be displayed as the notification. Notifications display buttons that enable the user to close them and automatically fade out after an interval of five seconds.
In the case of controls, notifications appear as validation messages. In the case of application windows, notifications are stacked on the window from which they originate.

Example

The following example demonstrates how to display stacked notification messages.

function showStackedNotification()
{
     var feedbackObject = new Object();
     // inputName is the Id of html Element.
     feedbackObject.relatedHTMLElement = document.getElementById("inputName");
     feedbackObject.callbackFunction = callbackHandler;
     feedbackObject.applicationDefinition = newApplication.documentElement;
     application.notify("Click Here to execute the callback function.", "Test", null, feedbackObject);
}
function callbackHandler()
{
    // the code to be executed onclick of the notification message link.
}
<script type="cordys/xml" id="newApplication">
    <Application>
        <url>Application URL </url>
        <id>Application Id</id>
        <caption>Application caption</caption>
        <description>Application description</description>
        <frame>main</frame>
        <data/>
    </Application>
</script>
<html>
<body>
    <div>
          <label>Name:<label><inputid="inputName" class="input" type="text">
    </div>
</body>
</html>


The following example demonstrates how to display a notification message for an HTML element.

function showNotificationNearInput()
{
    var feedbackObject = new Object();
    // inputName is the Id of html Element.
    feedbackObject.relatedHTMLElement = document.getElementById("inputName");
    feedbackObject.callbackFunction = callbackHandler;
    feedbackObject.applicationDefinition = newApplication.documentElement;
    application.notify("Click Here to execute the callback function.", "Test", document.getElementById("inputName"), feedbackObject);
}
function callbackHandler()
{
    // the code to be executed onclick of the notification message link.
}
<script type="cordys/xml" id="newApplication">
    <Application>
        <url>Application URL </url>
        <id>Application Id</id>
        <caption>Application caption</caption>
        <description>Application description</description>
        <frame>main</frame>
        <data/>
    </Application>
</script>
<html>
<body>
     <div>
          <label>Name :</label><input id="inputName" class="input" type="text"/>
     </div>
</body>
</html>